package com.exam.hellohass.data;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

import com.exam.hellohass.utils.JsoupThread;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class ContenData {
	String url = "";
	
	public static Bitmap getHttpBitmap(String url) {
		URL myImageuUrl;
		Bitmap imgBitmap = null;
		
		try {
			myImageuUrl = new URL(url);
			HttpURLConnection conn = (HttpURLConnection) myImageuUrl.openConnection();
			conn.setReadTimeout(5000);
			conn.setConnectTimeout(5000);
			conn.setDoInput(true);
			InputStream is = conn.getInputStream();
			imgBitmap = BitmapFactory.decodeStream(is);
			is.close();
			
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return imgBitmap;
	}
	
	
}
